package com.xbongbong.paas.service;

import com.xbongbong.paas.pojo.dto.CustomerRuleDetailDTO;
import com.xbongbong.paas.pojo.dto.CustomerRuleGetRemindTimeDTO;
import com.xbongbong.paas.pojo.dto.CustomerRuleListDTO;
import com.xbongbong.paas.pojo.dto.CustomerRuleSaveDTO;
import com.xbongbong.paas.pojo.dto.CustomerRuleSaveRemindTimeDTO;
import com.xbongbong.paas.pojo.dto.CustomerRuleUserListDTO;
import com.xbongbong.paas.pojo.dto.ReturnCustomer2PublicAsyncDTO;
import com.xbongbong.paas.pojo.vo.CustomerListRuleVO;
import com.xbongbong.paas.pojo.vo.CustomerRuleDetailVO;
import com.xbongbong.paas.pojo.vo.CustomerRuleRemindTimeVO;
import com.xbongbong.paas.pojo.vo.CustomerRuleUserListVO;
import com.xbongbong.paas.pojo.vo.ReturnCustomer2PublicAsyncVO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.XbbResponse;
import com.xbongbong.saas.domain.entity.CustomerRuleEntity;
import com.xbongbong.sys.domain.entity.UserEntity;

import java.util.List;

/**
 * @author youli.chen
 * @ProjectName xbb-pro
 * @Description: 公海池规则
 * @date 2019/1/24 10:57
 */
public interface CustomerRuleService {

    /**
     * 【web】规则列表
     *
     * @param customerRuleListDTO 获取规则入参
     * @return CustomerListRuleVO
     * @throws XbbException 业务异常
     * @version v1.0
     * @since v1.0
     */
    XbbResponse<CustomerListRuleVO> getCustomerRuleList(CustomerRuleListDTO customerRuleListDTO) throws XbbException;

    /**
     * 【web】规则详情
     *
     * @param customerRuleDetailDTO 获取规则详情入参
     * @return CustomerRuleDetailVO
     * @throws XbbException 业务异常
     * @version v1.0
     * @since v1.0
     */
    XbbResponse<CustomerRuleDetailVO> getCustomerRuleDetail(CustomerRuleDetailDTO customerRuleDetailDTO) throws XbbException;

    /**
     * 【web】保存规则
     *
     * @param customerRuleSaveDTO 保存规则入参
     * @return Integer
     * @throws XbbException 业务异常
     * @version v1.0
     * @since v1.0
     */
    XbbResponse<Integer> save(CustomerRuleSaveDTO customerRuleSaveDTO) throws XbbException;

    /**
     * 【web】保存公海池退回提醒时间
     *
     * @param customerRuleSaveRemindTimeDTO 保存公海池退回提醒时间入参
     * @return Integer
     * @throws XbbException 业务异常
     * @version v1.0
     * @since v1.0
     */
    XbbResponse<Integer> saveRemindTime(CustomerRuleSaveRemindTimeDTO customerRuleSaveRemindTimeDTO) throws XbbException;

    /**
     * 【web】获取公海池退回提醒时间
     *
     * @param customerRuleGetRemindTimeDTO 获取公海池退回提醒时间入参
     * @return Integer
     * @throws XbbException 业务异常
     * @version v1.0
     * @since v1.0
     */
    XbbResponse<CustomerRuleRemindTimeVO> getRemindTime(CustomerRuleGetRemindTimeDTO customerRuleGetRemindTimeDTO) throws XbbException;

    /**
     * 【web】公海规则设置选择员工
     *
     * @param customerRuleUserListDTO 公海规则设置选择员工入参
     * @return Integer
     * @throws XbbException 业务异常
     * @version v1.0
     * @since v1.0
     */
    XbbResponse<CustomerRuleUserListVO> userList(CustomerRuleUserListDTO customerRuleUserListDTO) throws XbbException;

    /**
     * 客户公海规则脚本异步方法
     *
     * @param returnCustomer2PublicAsyncDTO 客户公海规则脚本入参
     * @return Integer
     * @throws XbbException 业务异常
     * @version v1.0
     * @since v1.0
     */
    XbbResponse<ReturnCustomer2PublicAsyncVO> returnCustomer2PublicAsync(ReturnCustomer2PublicAsyncDTO returnCustomer2PublicAsyncDTO) throws XbbException;

    /**
     * 公海分配规则判断
     * @param corpid
     * @param userEntity
     * @param customerId
     * @param ruleList
     * @return
     * @throws XbbException 业务异常
     * 创建时间 2019/4/12 9:51 AM
     * 修改时间 2019/4/12 9:51 AM
     * @author chy
     * @since v1.0
     * @version v1.0
     */
    Integer canGainCustomer(String corpid, UserEntity userEntity, Long customerId, List<CustomerRuleEntity> ruleList, int dataIdSize) throws XbbException;

    /**
     * 更新redis中的捞取频次
     * @param corpid
     * @param userEntity
     * @throws XbbException
     */
    void updateGainRateToRedis(String corpid,UserEntity userEntity) throws XbbException;

    /**
     * 更新redis中的捞取频次
     * @param corpid
     * @param userEntity
     * @param ids
     * @throws XbbException
     */
    void updateGainRateByIds(String corpid,UserEntity userEntity, List<Long> ids) throws XbbException;


    /**
     * 动态去除客户标签
     * @param corpid
     * @param customerIds
     * @throws XbbException
     * 创建时间 2019/4/16 8:14 PM
     * 修改时间 2019/4/16 8:14 PM
     * @author chy
     * @since v1.0
     * @version v1.0
     */
    void deletePublicTag(String corpid, List<Long> customerIds) throws XbbException;


    /**
     * 当客户状态当数据字典增减时，系统默认修改数据字典
     * @param corpid
     * @throws XbbException
     * 创建时间 2019/8/6 3:56 PM
     * 修改时间 2019/8/6 3:56 PM
     * @author chy
     * @since v1.1.3
     * @version v1.1.3
     */
    public void customerTypeChage(String corpid) throws XbbException;
}
